package prototype.persistence.hibernate;

import java.util.List;
import java.sql.Timestamp;

import prototype.persistence.pojo.UserHasUnit;
import prototype.persistence.UserHasUnitDAO;

import org.hibernate.criterion.Restrictions;

/**
 * <p>Hibernate DAO layer for UserHasUnits</p>
 * <p>Generated at Sun Jan 03 13:49:53 EET 2010</p>
 *
 * @author Salto-db Generator v1.0.16 / Pojos + Hibernate mapping + Generic DAO
 * @see http://www.hibernate.org/328.html
 */
public class UserHasUnitHibernateDAO extends
		AbstractHibernateDAO<UserHasUnit, Integer> implements
		UserHasUnitDAO {

	/**
	 * Find UserHasUnit by userId
	 */
	@SuppressWarnings("unchecked")
	public List<UserHasUnit> findByUserId(Integer userId) {
		return findByCriteria(Restrictions.eq("user.userId", userId));
	}
	
	/**
	 * Find UserHasUnit by unitId
	 */
	@SuppressWarnings("unchecked")
	public List<UserHasUnit> findByUnitId(Integer unitId) {
		return findByCriteria(Restrictions.eq("unit.unitId", unitId));
	}
	
	/**
	 * Find UserHasUnit by positionId
	 */
	@SuppressWarnings("unchecked")
	public List<UserHasUnit> findByPositionId(Integer positionId) {
		return findByCriteria(Restrictions.eq("position.positionId", positionId));
	}
	

}
